using System.ComponentModel.DataAnnotations;

namespace Lzfy_His_Service.Models
{
    /// <summary>
    /// 退费情况数据模型
    /// </summary>
    public class RefundStatusData
    {
        /// <summary>
        /// 主键ID（用于分页优化）
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 患者姓名
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        public string? IdNumber { get; set; }

        /// <summary>
        /// 预存时间
        /// </summary>
        public string? CreateTime { get; set; }

        /// <summary>
        /// 期初余额
        /// </summary>
        public decimal Balance { get; set; }

        /// <summary>
        /// 当前余额
        /// </summary>
        public decimal CurrentBalance { get; set; }

        /// <summary>
        /// 退款结果
        /// </summary>
        public string? RefundResult { get; set; }

        /// <summary>
        /// 线上退款审核人
        /// </summary>
        public string? AuditUserName { get; set; }

        /// <summary>
        /// 短信联系结果
        /// </summary>
        public string? MsgResult { get; set; }
    }

    /// <summary>
    /// 退费情况查询请求模型
    /// </summary>
    public class RefundStatusQueryRequest
    {
        /// <summary>
        /// 页码（从1开始）
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; } = 50;

        /// <summary>
        /// 患者姓名（可选筛选条件）
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 身份证号（可选筛选条件）
        /// </summary>
        public string? IdNumber { get; set; }

        /// <summary>
        /// 退款结果筛选（可选）
        /// </summary>
        public string? RefundResult { get; set; }

        /// <summary>
        /// 预存开始时间（可选）
        /// </summary>
        public DateTime? CreateTimeStart { get; set; }

        /// <summary>
        /// 预存结束时间（可选）
        /// </summary>
        public DateTime? CreateTimeEnd { get; set; }
    }

    /// <summary>
    /// 退费情况查询响应模型
    /// </summary>
    public class RefundStatusQueryResponse
    {
        /// <summary>
        /// 数据列表
        /// </summary>
        public List<RefundStatusData> Items { get; set; } = new List<RefundStatusData>();

        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int PageIndex { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages => PageSize > 0 ? (int)Math.Ceiling((double)TotalCount / PageSize) : 0;
    }

    /// <summary>
    /// 导出请求模型
    /// </summary>
    public class RefundStatusExportRequest
    {
        /// <summary>
        /// 患者姓名（可选筛选条件）
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 身份证号（可选筛选条件）
        /// </summary>
        public string? IdNumber { get; set; }

        /// <summary>
        /// 退款结果筛选（可选）
        /// </summary>
        public string? RefundResult { get; set; }

        /// <summary>
        /// 预存开始时间（可选）
        /// </summary>
        public DateTime? CreateTimeStart { get; set; }

        /// <summary>
        /// 预存结束时间（可选）
        /// </summary>
        public DateTime? CreateTimeEnd { get; set; }

        /// <summary>
        /// 导出格式（excel/csv）
        /// </summary>
        public string ExportFormat { get; set; } = "excel";
    }

    /// <summary>
    /// 导出预估信息模型
    /// </summary>
    public class RefundStatusExportEstimate
    {
        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 预估文件大小（字节）
        /// </summary>
        public long EstimatedSizeBytes { get; set; }

        /// <summary>
        /// 预估导出时间（分钟）
        /// </summary>
        public int EstimatedDurationMinutes { get; set; }
    }
}